Creating a Button that Calls an Action Script

Description

Configure a button that uses an action script and the OnPush Event. This page contains a code explanation.

Button2 uses an Action Script to copy the customer billing address to the shipping address. Button2 uses a bitmap instead of text to define its purpose.

images/Copy_button.gif

Procedure: Configuring the Button2 Button

The following procedure assumes that the developer has opened the form in the Form Editor. Follow these instructions to create a button similar to Button2 :

  1. Place a button on the form.

  2. On the resulting Define Button dialog box click the Define Picture button.

    images/AL_form_customer_information_button3_create0.gif
  3. Click the Internal combo box to open it up.

    images/AL_form_customer_information_button3_create1.gif
  4. Select the image in the resulting Insert Image dialog box.

  5. Click the Addin images radio button.

  6. Click the Insert button.

    images/AL_form_customer_information_button2_create2.gif
  7. In the Define Picture dialog box click the OK button.

    images/AL_form_customer_information_button2_create3.gif
  8. In the Define Button dialog box click the Next button.

  9. Click the Add New Action button to start defining an Action Script (refer to ((|#Button2_OnPush_Event|Button2 OnPush Event)) ).

  10. If you are in the Code Editor, close and save your code.

  11. Click the Finish button.

Action Script Run by the Button2 OnPush Event

Clicking Button2 runs the following Action Script, which displays a dialog box to confirm that the user wants to copy the shipping address to the billing address and copies the shipping address to the billing address.

Display a Message Box(ID 'copyAddress')
Set Field Values

An Explanation of the Code

The follow Action displays a message box to confirm that the user wants to copy the shipping address to the billing ' address.

Display a Message Box(ID 'copyAddress')

If the user clicks OK, the following Action copies: Ship_country to Bill_country, Ship_zip to Bill_Postal_Code, Ship_state to Bill_State_Region. Ship_city to Bill_city, Ship_address_1 to Bill_address_1, and Ship_address_2 to Bill_address_2.

Set Field Values

See Also